Ext.define('Seq.tree.All', {
	        extend : 'Ext.tree.Panel',
	        xtype : 'xtreeall',

	        config : {
		        rootSelected : true,
		        model : 'Seq.model.Tree',
		        url : undefined,
		        params : {}
	        },

	        rootVisible : false,

	        initComponent : function() {
		        var me = this;
		        me.store = Ext.create('Ext.data.TreeStore', {
			                model : me.config.model
		                });
		        me.callParent();
	        },
	        
	        listeners : {
		        afterrender : function(view) {
			        var me = this, store = me.getStore();
			        Seq.Ajax.request({
				                url : me.getUrl(),
				                params : me.params,
				                fnSuccess : function(option, result) {
					                var root = me.config.root || {};
					                if (Ext.typeOf(result.data) === 'array') {
						                Ext.apply(root, {
							                        expanded : true,
							                        leaf : result.data.length == 0,
							                        children : result.data
						                        });
					                } else if (Ext.isEmpty(result.data.text)) {
						                Ext.apply(root, {
							                        expanded : true,
							                        leaf : result.data.children.length == 0,
							                        children : result.data.children
						                        });
					                } else {
						                Ext.apply(root, result.data);
					                }
					                store.setRoot(root);
					                me.expandAll();

					                var root = me.getRootNode();
					                if (Ext.isEmpty(me.config.root) && root.hasChildNodes()) {
						                root = root.getChildAt(0);
					                }
					                me.rootSelected && me.setSelection(root);
				                }
			                });
		        }
	        }
        });
